# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=libcoap
pkgver=4.2.1
pkgrel=1
pkgdesc="A CoAP (RFC 7252) implementation"
url="https://libcoap.net/"
arch="all"
license="BSD-2-Clause"
makedepends="automake autoconf libtool asciidoc openssl-dev"
checkdepends="cunit-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/obgm/libcoap/archive/v$pkgver.tar.gz"

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--with-openssl \
		--disable-doxygen \
		--enable-tests
	make
}

check() {
	./tests/testdriver
}

package() {
	make DESTDIR="$pkgdir" install

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
	install -m644 CONTRIBUTE AUTHORS ChangeLog NEWS README.md TODO \
		"$pkgdir"/usr/share/doc/$pkgname
}

sha512sums="ac081a5ff249683eb2c8ee22a5359408478d8365933991680586805ce109d7f50dcbb9a9d9fb268f1468bcc2acc05d6820258123bc935bb2d463175022162d20  libcoap-4.2.1.tar.gz"
